package talayaco.gui;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;

import talayaco.utils.VersionPrograma;

public class MainDesktopPane extends JDesktopPane {

	private static final long serialVersionUID = 1L;
	private Image image;

	public MainDesktopPane() {
		super();

		// 0: choquiTYSA
		// 1: grandeDELFINA
		// 2: grandeTYSA
		// 3: mediaTYSA
		// 4: mediaDELFINA
		if (VersionPrograma.VERSION_IMAGEN == 0)
			image = new ImageIcon(getClass().getResource("choquitysa.jpg")).getImage();
		else if (VersionPrograma.VERSION_IMAGEN == 1)
			image = new ImageIcon(getClass().getResource("grandedelfina.jpg")).getImage();
		else if (VersionPrograma.VERSION_IMAGEN == 2)
			image = new ImageIcon(getClass().getResource("grandetysa.jpg")).getImage();
		else if (VersionPrograma.VERSION_IMAGEN == 3)
			image = new ImageIcon(getClass().getResource("mediadelfina.jpg")).getImage();
		else if (VersionPrograma.VERSION_IMAGEN == 4)
			image = new ImageIcon(getClass().getResource("mediatysa.jpg")).getImage();
		
		setBackground(new Color(69, 64, 92));
	}

	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		int h = (int) image.getHeight(null) / 2;
		int w = (int) (image.getWidth(null) / 2);
		g.drawImage(image, (int) getWidth() / 2 - w, (int) getHeight() / 2 - h,
				null);
	}
}
